//
//  CommunitiesModel.swift
//
//  Created by Icy on 2017/3/25
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol

 public class CommunitiesModel: ModelProtocol {

    // MARK: Declaration for string constants to be used to decode and also serialize.
	internal let kCommunitiesLngKey: String = "lng"
	internal let kCommunitiesNameKey: String = "name"
	internal let kCommunitiesInternalIdentifierKey: String = "id"
	internal let kCommunitiesLatKey: String = "lat"
	internal let kCommunitiesTenantIdKey: String = "tenantId"
	internal let kCommunitiesAddressKey: String = "address"


    // MARK: 属性
	 public var lng: Float
	 public var name: String
	 public var internalIdentifier: Int
	 public var lat: Float
	 public var tenantId: Int
	 public var address: String


    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
   public required  init?(json: JSON) {
		lng = json[kCommunitiesLngKey].floatValue
		name = json[kCommunitiesNameKey].stringValue
		internalIdentifier = json[kCommunitiesInternalIdentifierKey].intValue
		lat = json[kCommunitiesLatKey].floatValue
		tenantId = json[kCommunitiesTenantIdKey].intValue
		address = json[kCommunitiesAddressKey].stringValue

    }


    /**
    Generates description of the object in the form of a NSDictionary.
    - returns: A Key value pair containing all valid values in the object.
    */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {

        var dictionary: [String : AnyObject ] = [ : ]

			dictionary.updateValue(lng as AnyObject, forKey: kCommunitiesLngKey)
		

			dictionary.updateValue(name  as AnyObject, forKey: kCommunitiesNameKey)
		

			dictionary.updateValue(internalIdentifier  as AnyObject, forKey: kCommunitiesInternalIdentifierKey)
		

			dictionary.updateValue(lat  as AnyObject, forKey: kCommunitiesLatKey)
		

			dictionary.updateValue(tenantId  as AnyObject, forKey: kCommunitiesTenantIdKey)
		

			dictionary.updateValue(address as AnyObject, forKey: kCommunitiesAddressKey)
		

        return dictionary
    }


}
